program eva;
var a:array[1..100,1..3] of integer;
    n,d,site2,maxl,head,code:integer;
    s:string;
procedure rei;
var i,j:integer;
begin
  for i:=1 to n do
   begin
    a[i,2]:=1;
    a[i,3]:=0;
   end;

  for i:=n downto 1 do
    begin
      if a[i,1]>-1 then
        begin
            for j:=i+1 to n do
                begin
                  if (a[j,1]>-1)and(a[j,1]a[i,2]) then
                    begin
                      a[i,2]:=a[j,2]+1;
                      a[i,3]:=j;
                    end;
                end;
        end;
    end;
end;
function asuka:boolean;
var i:integer;
begin
  asuka:=false;
  for i:=1 to n do
    if a[i,1]>-1 then
      begin
        asuka:=true;
        exit;
      end;

end;
function shinji:integer;
var i,j,k,m,site:integer;
begin
  m:=0;
  while asuka do
   begin
     rei;
     j:=0;
     for i:=1 to n do
       if (a[i,2]>j)and(a[i,1]>-1) then
         begin
           j:=a[i,2];
           k:=i;
         end;
     inc(m);
     site:=k;
     repeat
       a[site,1]:=-1;
       site:=a[site,3];
     until a[site,3]=0;
     a[site,1]:=-1;
   end;
  shinji:=m;
end;
begin
  readln(s);
  s:=s+' ';
  d:=1;head:=1;
  n:=0;
  while d<=length(s) do
    begin
      if s[d]=' ' then
        begin
          inc(n);
          val(copy(s,head,(d-head)),a[n,1],code);
          head:=d+1;
        end;
      inc(d);
    end;
  rei;
  for d:=1 to n do
    begin
      if a[d,2]>maxl then
         begin
           maxl:=a[d,2];
           site2:=d;
         end;
    end;
  writeln(maxl);
  writeln(shinji);
end.